<?php


/* Name: connectDB
 * Parameters: non
 * Function: Connects to mySQL database
 */
   function connectDB() {
       mysql_connect("localhost", "thnbgr_nation", "123456") or die(mysql_error());
       mysql_select_db("thnbgr_nationsim") or die(mysql_error());
   }

/* Name: Display
 * Parameters: item - item to display
 * Function: Misc display function
 */
   function display($item) {
        switch ($item) {
            case 'header':
                echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                        <html>
                        <head>
                        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                        <title>NationSim - PHP</title>
                        </head>';
            break;
            
        }
    }


/* Name: newLine
 * Parameters: none
 * Function: Creates a new line
 */
    function newLine(){
        echo '<br />';
    }


/* Name: checkValid
 * Parameters: var - variable
 * Function: Checks if a variable is not empty
 */
    
    function checkValid($var){
        return (!empty($var)) ? true : false;
    }

?>
